Skip to content

CharacterRandomizer: Change hair and cloth colors too#2143

Open
manuq wants to merge 2 commits into
mainfrom
townies-hair-cloth
Open

CharacterRandomizer: Change hair and cloth colors too#2143
manuq wants to merge 2 commits into
mainfrom
townies-hair-cloth

Conversation

@manuq
Copy link
Copy Markdown
Collaborator

@manuq manuq commented Apr 22, 2026

Before, the shader swapped 3 colors: light, medium and dark. The script had a
way to derive the light and dark colors from the medium one. And the key colors
were 3 shades of green.

Go back to the palette-swap shader reference [1] and only change variable names
and comments.

Townie asset:

  • Change the colors so skin is yellow and clothes are green.

  • Manually paint the contour lines of shapes, to a darker value of the fill
    color. This adds a 4th color to the cel shading, which will be mapped to a
    dark line or a light line, for more readability.

  • Export all PNG spritesheets.

CelShadingRecolor:

  • Pass the two palettes to the shader.

  • Add lists of hair tones and clothes tones. The latter is rather arbitrary and
    could be improved in the future.

  • Export buttons to randomize the first 4 colors of the palette for the skin,
    the next 4 for the hair, and the last 4 for the clothes.

[1] https://github.com/KoBeWi/Godot-Palette-Swap-Shader/blob/master/addons/PaletteSwapShader/SimplePaletteSwap.gdshader

Resolve #2204

@github-actions
Copy link
Copy Markdown

Play this branch at https://play.threadbare.game/branches/endlessm/townies-hair-cloth/.

(This launches the game from the start, not directly at the change(s) in this pull request.)

@manuq manuq force-pushed the townies-hair-cloth branch 2 times, most recently from 3dcff49 to 5850caf Compare April 23, 2026 19:14
@manuq
Copy link
Copy Markdown
Collaborator Author

manuq commented Apr 24, 2026

There is a problem with this approach: it doesn't work with the effects in Fray's End:

Check this 2 townies in editor:
Captura desde 2026-04-24 09-43-54

And in game, the colors change:
Captura desde 2026-04-24 09-43-44

Do not rely on instance shader parameters for recoloring. Instead, make the
material unique when a different recolor is needed. For instance, by duplicating
the cel_shading_recolor_material.tres.

Now the way to have the same recoloring in multiple sprites is to share the same
material.

Townie: have a duplicate copy of the cel shading recolor material. Apply it to all
the parts.
@manuq manuq force-pushed the townies-hair-cloth branch from cfb3f4b to b68c46b Compare May 15, 2026 20:01
Before, the shader swapped 3 colors: light, medium and dark. The script had a
way to derive the light and dark colors from the medium one. And the key colors
were 3 shades of green.

Go back to the palette-swap shader reference [1] and only change variable names
and comments.

Townie asset:

- Change the colors so skin is yellow and clothes are green.

- Manually paint the contour lines of shapes, to a darker value of the fill
  color. This adds a 4th color to the cel shading, which will be mapped to a
  dark line or a light line, for more readability.

- Export all PNG spritesheets.

CelShadingRecolor:

- Pass the two palettes to the shader.

- Add lists of hair tones and clothes tones. The latter is rather arbitrary and
  could be improved in the future.

- Export buttons to randomize the first 4 colors of the palette for the skin,
  the next 4 for the hair, and the last 4 for the clothes.

[1] https://github.com/KoBeWi/Godot-Palette-Swap-Shader/blob/master/addons/PaletteSwapShader/SimplePaletteSwap.gdshader

Resolve #2204
@manuq manuq force-pushed the townies-hair-cloth branch from b68c46b to 2443780 Compare May 15, 2026 20:28
@manuq
Copy link
Copy Markdown
Collaborator Author

manuq commented May 15, 2026

This is now on top of #2163

The palette swap works now, but:

  • To avoid the existing characters to have different look, I had to apply the new randomizations (hair, clothes) at the bottom in the script. I left a TODO about it.
  • Because the exported ShaderMaterial in Townie is set to "local to scene" (to make each instance unique), now the shader parameters data is duplicated in every scene. Check Arun, who appears in several scenes of the tutorial.

@manuq manuq marked this pull request as ready for review May 15, 2026 20:48
@manuq manuq requested a review from a team as a code owner May 15, 2026 20:48
@manuq
Copy link
Copy Markdown
Collaborator Author

manuq commented May 15, 2026

Hmm from main it looks like Marie has changed compared with 3 weeks ago so maybe is fine to remove the TODO note and just call cel_shading_recolor.randomize(_random_number_generator). And play with the randomize buttons again to find characters that suit better.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Townie: Generalize skin recolor to full palette swap

1 participant